#include "stdafx.h"
#include "Buffer.h"

CxBuffer::CxBuffer()
{}

CxBuffer::~CxBuffer()
{}

HRESULT CxBuffer::GetBuffer(LPBYTE* ppBuffer)
{
    if (!ppBuffer)
    {
        return E_POINTER;
    }

    *ppBuffer = (LPBYTE)m_buffer.data();

    return S_OK;
}

HRESULT CxBuffer::Resize(UINT uSize, BYTE** ppbyBuf)
{
    m_buffer.resize(uSize);

    if (ppbyBuf)
    {
        *ppbyBuf = (BYTE*)m_buffer.data();
    }

    return S_OK;
}

HRESULT CxBuffer::GetSize(LPUINT lpuSize)
{
    if (!lpuSize)
    {
        return E_POINTER;
    }

    *lpuSize = (UINT)m_buffer.size();

    return S_OK;
}

HRESULT CxBuffer::Clear()
{
    m_buffer.clear();
    return S_OK;
}